package cn.memedai.router;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import cn.memedai.router.annotation.Route;



/**
 * RouteInterceptor
 * @author gaojun
 * @version 1.0.0
 */
public interface RouteInterceptor {
    /**
     * Invoke the Activity Interceptor {@link Route#interceptors()} intercepted method{@link RouteInterceptor#intercepted(Context, Uri, Bundle)}
     * and GlobalInterceptors when return true
     * @param context Context
     * @param uri     Uri
     * @param extras  Bundle
     * @return True if you want to intercept this route, false otherwise.
     */
    boolean intercept(Context context, @NonNull Uri uri, @Nullable Bundle extras);

    /**
     *  when intercept return true ,the method will be invoked
     * @param context context
     * @param uri uri
     * @param extras extras
     */
    void intercepted(Context context, @NonNull Uri uri, @Nullable Bundle extras);
}
